from pml import Objects
from pml import PML

class Stdio(Objects.object.typeobject):
    def __init__(self):
        super().__init__('Stdio')

    def getObject(self):
        self.methods['write'] = self.write

        return self

    @staticmethod
    def write(frame, this: 'Stdio', position, text):
        print(text if isinstance(text, str) else text.__repr__(), end='')

    @staticmethod
    def get(frame, this: 'Stdio', position, text=''):
        return PML.object.ChangeObject.PMLString_FromStr(input(text if isinstance(text, str) else text.__repr__()))
